<ul class='list-image clearfix'>
<?php 
	$images = $this->images;
	foreach($images as $image):
?>
<li>
	<div class='image'>
		<a class="fancybox-gallery" data-fancybox-group="button" href="<?php echo PUBLIC_RESOURCE.'/uploads/images/products/400x400/'.$image["product_image_name"]?>">
		<img
			src='<?php echo PUBLIC_RESOURCE.'/uploads/images/products/thumbs/'.$image["product_image_name"]?>'
			alt='' />
		</a>
	</div>
	<p class='controller'>
		<a
			href="<?php echo $this->baseUrl().'/admin/product/deleteimage/id/'.$image["product_image_id"]?>"
			class='remove-image' title='xóa'> <span>&nbsp;</span>
		</a>
	</p>
</li>
<?php endforeach;?>
</ul>
<script>
$(document).ready(function(){
	$('.fancybox-gallery').fancybox({
		openEffect  : 'none',
		closeEffect : 'none',
		prevEffect : 'none',
		nextEffect : 'none',
		closeBtn  : true,
		helpers : {
			title : {
				type : 'inside'
			},
			buttons	: {},
			
		},

		
	});
	
	//xóa hình
	$('.remove-image').on("click",function(){
		var _this = $(this);
		var link = _this.attr('href');

		if(confirm("bạn chắc chắn muốn xóa?")){
			$.ajax({
				type: 'get',
				url: link,
				success:function(data){
					_this.parent('p.controller').parent('li').remove();
				}
			});
		}
		return false;
	});
	
});
</script>